home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 1996
/
MacHack 1996.toast
/
Hacks
/
Hacks ’87
/
Source ƒ.sit
/
Source ƒ
/
C ƒ
/
CITADEL BBS 'C' SRC
/
LIBNET.C
< prev
next >
Wrap
C/C++ Source or Header
|
1987-01-14
|
2KB
|
69 lines
/************************************************************************/
/* libnet.c */
/* */
/* Library net functions */
/************************************************************************/
/************************************************************************/
/* history */
/* */
/* 85Nov15 HAW Created. */
/************************************************************************/
#include "ctdl.h"
struct netBuffer netBuf;
extern struct netTable *netTab;
int thisNet;
FILE *netfl;
/************************************************************************/
/* contents */
/* */
/* getNet() gets a node from CTDLNET.SYS */
/* putNet() puts a node to CTDLNET.SYS */
/************************************************************************/
/************************************************************************/
/* getNet() Gets a net node from the file. */
/************************************************************************/
getNet(n)
int n;
{
long int r, s;
thisNet = n;
r = sizeof netBuf;
s = n * r;
fseek(netfl, s, 0);
if (fread(&netBuf, sizeof netBuf, 1, netfl) != 1) {
crashout("?getNet-read fail!!");
}
crypte(&netBuf, sizeof netBuf, n);
}
/************************************************************************/
/* putNet() put node to file */
/************************************************************************/
putNet(n)
int n;
{
long int r, s;
thisNet = n;
netTab[n].ntflags.in_use = netBuf.nbflags.in_use ;
netTab[n].ntflags.room_files = netBuf.nbflags.room_files ;
netTab[n].ntflags.normal_mail = netBuf.nbflags.normal_mail;
netTab[n].ntflags.local = netBuf.nbflags.local;
r = sizeof netBuf;
s = n * r;
crypte(&netBuf, sizeof netBuf, n);
fseek(netfl, s, 0);
if (fwrite(&netBuf, sizeof netBuf, 1, netfl) != 1) {
crashout("?getNet-write fail!!");
}
crypte(&netBuf, sizeof netBuf, n);
}